home *** CD-ROM | disk | FTP | other *** search
- {$G+,X+}
-
- {Conditional defines that may affect this unit}
- {$I AWDEFINE.INC}
-
- {*********************************************************}
- {* KERMOPT.PAS 1.01 *}
- {* Copyright (c) TurboPower Software 1995 *}
- {* All rights reserved. *}
- {*********************************************************}
-
- unit Kermopt;
-
- interface
-
- uses
- SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
- Forms, Dialogs, StdCtrls, ExtCtrls, Buttons, TComIni;
-
- type
- TKermitOptionsForm = class(TForm)
- ErrorCorrectionBox: TRadioGroup;
- GroupBox1: TGroupBox;
- Label1: TLabel;
- Label2: TLabel;
- PaddingCountEdit: TEdit;
- PaddingCharEdit: TEdit;
- GroupBox2: TGroupBox;
- Label3: TLabel;
- HibitEdit: TEdit;
- Label4: TLabel;
- Label5: TLabel;
- RepeatEdit: TEdit;
- ControlEdit: TEdit;
- GroupBox3: TGroupBox;
- Label6: TLabel;
- Label7: TLabel;
- MaxLengthEdit: TEdit;
- TerminatorEdit: TEdit;
- OkBtn: TBitBtn;
- CancelBtn: TBitBtn;
- HelpBtn: TBitBtn;
- procedure OkBtnClick(Sender: TObject);
-
- public
- constructor Create(AOwner : TComponent); override;
- end;
-
- implementation
-
- {$R *.DFM}
-
- constructor TKermitOptionsForm.Create(AOwner : TComponent);
- begin
- inherited Create(AOwner);
-
- ErrorCorrectionBox.ItemIndex := Ord(ErrCheck) - Ord('1');
- PaddingCountEdit.Text := IntToStr(PadCount);
- PaddingCharEdit.Text := IntToStr(Ord(PadChar));
- HibitEdit.Text := IntToStr(Ord(HiBitPrefix));
- RepeatEdit.Text := IntToStr(Ord(RepeatPrefix));
- ControlEdit.Text := IntToStr(Ord(CtlPrefix));
- MaxLengthEdit.Text := IntToStr(MaxPacketLen);
- TerminatorEdit.Text := IntToStr(Ord(Terminator));
- end;
-
- procedure TKermitOptionsForm.OkBtnClick(Sender: TObject);
-
- function TestChar(Edit : TEdit) : Boolean;
- var
- E : Integer;
- L : LongInt;
-
- begin
- Val(Edit.Text, L, E);
- if (E <> 0) or (L < 0) or (L > 255) then begin
- MessageDlg('You must enter a numeric value between 0 and 255.', mtError, [mbOK], 0);
- Edit.SetFocus;
- Result := False
- end else
- Result := True;
- end;
-
- begin
- if not TestChar(PaddingCountEdit)
- or not TestChar(PaddingCharEdit)
- or not TestChar(HibitEdit)
- or not TestChar(RepeatEdit)
- or not TestChar(ControlEdit)
- or not TestChar(MaxLengthEdit)
- or not TestChar(TerminatorEdit) then
- Exit;
-
- PadCount := StrToInt(PaddingCountEdit.Text);
- PadChar := Char(StrToInt(PaddingCharEdit.Text));
- HiBitPrefix := Char(StrToInt(HibitEdit.Text));
- RepeatPrefix := Char(StrToInt(RepeatEdit.Text));
- CtlPrefix := Char(StrToInt(ControlEdit.Text));
- MaxPacketLen := StrToInt(MaxLengthEdit.Text);
- Terminator := Char(StrToInt(TerminatorEdit.Text));
-
- ErrCheck := Char(ErrorCorrectionBox.ItemIndex + Ord('1'));
- end;
-
- end.
-
-